home *** CD-ROM | disk | FTP | other *** search
-
- /* This is for experimenting with backfill-hooks */
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <proto/intuition.h>
- #include <intuition/intuition.h>
- #include <proto/exec.h>
- #include <proto/graphics.h>
- #include <proto/layers.h>
- #include <libraries/gadtools.h>
-
- #include <graphics/gfxmacros.h>
-
- extern struct IntuitionBase *IntuitionBase;
- extern struct GfxBase *GfxBase;
- extern struct Library *GadToolsBase;
-
- struct LMsg {
- struct Layer *Layer;
- WORD MinX,MinY;
- WORD MaxX,MaxY;
- LONG OffsetX,OffsetY;
- } g[16];
-
- struct Task *this;
- ULONG signal;
- USHORT readp,writep;
-
- ULONG __interrupt __saveds __asm HookFunc(register __a0 struct Hook *hook,
- register __a2 struct RastPort *rastport,
- register __a1 struct LMsg *msg)
- {
- struct RastPort rp=*rastport;
-
- static __chip USHORT bitmap[]={0xaaaa,0x5555,0xaaaa};
-
- rp.Layer=NULL;
-
- g[writep]=*msg;
- writep=(writep+1)&15;
-
- Signal(this,signal);
-
- SetAPen(&rp,2);
- SetBPen(&rp,0);
- SetDrMd(&rp,JAM2);
-
- /* Adjust the pattern to the window position */
-
- if((msg->MinX ^ msg->MinY ^ msg->OffsetX ^ msg->OffsetY) & 1)
- {SetAfPt(&rp,(bitmap+1),1);} else
- {SetAfPt(&rp,bitmap,1);}
-
- /* RectFill(&rp,msg->MinX,msg->MinY,msg->MaxX,msg->MaxY);*/
-
-
- SetAPen(&rp,1);
-
- Move(&rp,msg->MinX,msg->MinY);
- Draw(&rp,msg->MaxX,msg->MaxY);
-
- return(0);
- }
-
-
- main()
- {
- struct IntuiMessage *msg;
- struct Window *win;
- int run=1;
-
- struct Hook hook;
-
- hook.h_Entry=(HOOKFUNC)HookFunc;
- hook.h_SubEntry=NULL;
-
- win=OpenWindowTags(NULL,
- WA_Left,0,WA_Top,20,
- WA_Width,300,WA_Height,100,
- WA_Title,"Test",
- WA_IDCMP,BUTTONIDCMP|IDCMP_CLOSEWINDOW|SLIDERIDCMP|
- IDCMP_NEWSIZE|IDCMP_REFRESHWINDOW,
- WA_Flags,WFLG_SIZEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET
- |WFLG_SIMPLE_REFRESH
- |WFLG_CLOSEGADGET|WFLG_ACTIVATE,
- WA_MinWidth,300,WA_MinHeight,100,
- WA_MaxWidth,-1,WA_MaxHeight,-1,
- WA_BackFill,&hook,
- TAG_DONE );
-
- if(!win) exit(0);
-
- this=FindTask(0);
- signal=1<<win->UserPort->mp_SigBit;
-
- Signal(this,signal);
-
- while(run) {
- Wait(signal);
-
- while(readp!=writep) {
- printf("%d %d %d %d %d %d\n",g[readp].MinX,g[readp].MinY,
- g[readp].MaxX,g[readp].MaxY,
- g[readp].OffsetX,g[readp].OffsetY);
- readp=(readp+1)&15;
- }
-
- while(msg=(void *)GetMsg(win->UserPort)) {
- switch(msg->Class) {
- case IDCMP_CLOSEWINDOW: run=0;
- break;
- }
- ReplyMsg((void *)msg);
- }
- }
- CloseWindow(win);
- return(0);
- }
-